import time
from classify.bayes.naive.multinomial_nb import *
from utils.DataUtil import DataUtil

if __name__ == '__main__':

    for dataset in ("balloon1.0", "balloon1.5"):
        path = "/home/xiefeihong/PycharmProjects/SimpleMachineLearning/static/classify/{}.txt".format(dataset)
        _x, _y = DataUtil.get_dataset(dataset, path)

        learning_time = time.time()
        nb = MultinomialNB()
        nb.fit(_x, _y)
        estimation_time = time.time()
        nb.evaluate(_x, _y)
        estimation_time = time.time() - estimation_time

        print(
            "Model builiding  : {:12.6} s\n"
            "Estimation     : {:12.6} s\n"
            "Total         : {:12.6} s".format(
                learning_time, estimation_time,
                learning_time + estimation_time
            )
        )